package com.yupi.oj.judge.codeSandBox;

import com.yupi.oj.judge.codeSandBox.model.ExecuteCodeRequest;
import com.yupi.oj.judge.codeSandBox.model.ExecuteCodeResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;

@Slf4j
public class CodeSandBoxProxy implements CodeSandBox{
//只改变一次所以改为final
    private final CodeSandBox codeSandBox;

    public CodeSandBoxProxy(CodeSandBox codeSandBox){
        this.codeSandBox = codeSandBox;
    }
    @Override
    public ExecuteCodeResponse executeCode(ExecuteCodeRequest executeCodeRequest) {
        log.info("代码沙箱请求信息："+ executeCodeRequest.toString());
        ExecuteCodeResponse codeResponse = codeSandBox.executeCode(executeCodeRequest);
        log.info("代码沙箱返回信息："+codeResponse.toString());
        return codeResponse;
    }
}
